#!/bin/bash
cd /home/nuc/
if [ -d ".golo_ws" ]
    then
    websocket_cid=$( cat /home/nuc/.golo_ws/src/golo/websocket-client/scripts/config_cid.py |grep cid |tr -d "cid=" |awk '{print $1}') 
    else
    websocket_cid=$( cat /home/nuc/golo_ws/src/golo/websocket-client/scripts/config_cid.py |grep cid |tr -d "cid=" |awk '{print $1}')
    fi
golo_cid=$( cat /opt/openresty/nginx/scripts/golo.conf |grep cid |tr -d "cid=")
cd  /opt/openresty/nginx/
sudo rm -rf  scripts
sudo git clone https://gitee.com/chluck2008/scripts.git
sleep 10
sudo sed -i "s#$golo_cid#$websocket_cid#g" /opt/openresty/nginx/scripts/golo.conf
sudo chmod 777 scripts/ -R